import wx
import sys
import os

class EducationDialog(wx.Dialog):
    def __init__(self,edu_areas, title = "Required education level"):
        wx.Dialog.__init__(self, None, -1, title,pos=(150,150),size=(200,200))
        
        self.edu_areas = edu_areas
        self.max = 0
        panel2 = wx.Panel(self, -1, size=(100,100))

        self.edulevel = wx.StaticText(panel2, -1, 'Miniumum Education Level', (20,25))
        self.edulevel.SetToolTip(wx.ToolTip("What is the required education (minimum) level."))
        wx.StaticLine(panel2, -1, (17, 30), (100,1))
        vert_pos = 45
        grouped_before = False 
        if 'Highschool' in self.edu_areas:
            self.Edu_high = wx.RadioButton(panel2, -1, 'High School', (20, vert_pos), style=wx.RB_GROUP)
            grouped_before = True
            vert_pos += 15
            self.max = 1
        if 'Associates' in self.edu_areas:
            if grouped_before:
                self.Edu_assoc = wx.RadioButton(panel2, -1, 'Associates', (20, vert_pos))
            else:
                self.Edu_assoc = wx.RadioButton(panel2, -1, 'Associates', (20, vert_pos), style=wx.RB_GROUP)
                grouped_before = True
            vert_pos += 15
            self.max = 2
        if 'Bachelors' in self.edu_areas:
            if grouped_before:
                self.Edu_bach = wx.RadioButton(panel2, -1, 'Bachelors', (20, vert_pos))
            else:
                self.Edu_bach = wx.RadioButton(panel2, -1, 'Bachelors', (20, vert_pos),style=wx.RB_GROUP)
                grouped_before = True
            vert_pos += 15
            self.max = 3
        if 'Masters' in self.edu_areas:
            if grouped_before:
                self.Edu_mast = wx.RadioButton(panel2, -1, 'Masters', (20, vert_pos))
            else:
               self.Edu_mast = wx.RadioButton(panel2, -1, 'Masters', (20, vert_pos),style=wx.RB_GROUP)
               grouped_before = True
            vert_pos += 15
            self.max = 4
        if 'PhD' in self.edu_areas:
            if grouped_before:
                self.Edu_phd = wx.RadioButton(panel2, -1, 'PhD', (20, vert_pos))
            else:
                self.Edu_phd = wx.RadioButton(panel2, -1, 'PhD', (20, vert_pos), style=wx.RB_GROUP)
            vert_pos += 15
            self.max = 5
                
        self.findBTN = wx.Button(panel2, -1, "Ok", (95,140))

        

    def Close(self):
            self.Destroy()

    def GetMinEducation(self): 
        min_education = 0
        if self.max == 1:
            if self.Edu_high.GetValue():
                min_education = 1
            
        if self.max == 2:
            if self.Edu_high.GetValue():
                ranking = 1
            elif self.Edu_assoc.GetValue():
                min_education = 2
        if self.max == 3:
            if self.Edu_high.GetValue():
                min_education = 1
            elif self.Edu_assoc.GetValue():
                min_education = 2
            elif self.Edu_bach.GetValue():
                min_education = 3
        if self.max == 4:
            if self.Edu_high.GetValue():
                min_education = 1
            elif self.Edu_assoc.GetValue():
                min_education = 2
            elif self.Edu_bach.GetValue():
                min_education = 3
            elif self.Edu_mast.GetValue():
                min_education = 4
        if self.max == 5:
            if self.Edu_high.GetValue():
                min_education = 1
            elif self.Edu_assoc.GetValue():
                min_education = 2
            elif self.Edu_bach.GetValue():
                min_education = 3
            elif self.Edu_mast.GetValue():
                min_education = 4
            elif self.Edu_phd.GetValue():
                min_education = 5

            
        return min_education
